package myky.com.doctorapp.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import myky.com.doctorapp.R
import myky.com.doctorapp.entity.QuikSearchEntity
import myky.com.doctorapp.utils.TextHighLight

class SearchDiseaseResultAdapter(data: List<QuikSearchEntity>?) : BaseQuickAdapter<QuikSearchEntity, BaseViewHolder>(R.layout.search_disease_result_item, data) {

    override fun convert(helper: BaseViewHolder, item: QuikSearchEntity) {

        val resultWord = item.resultWord

        val spannableStringBuilder = TextHighLight.matcherSearchContent(resultWord, arrayOf(item.keyword))

        helper.setText(R.id.diseaseName, spannableStringBuilder)

        helper.addOnClickListener(R.id.rootLayout)

    }
}
